/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *	  http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.milib.dbg.view.content.graph {
	import com.googlecode.milib.base.IMLBroadcasterListener;
	import com.googlecode.milib.base.MLBaseClass;
	import com.googlecode.milib.dbg.view.MLDBGTooltip;
	import com.googlecode.milib.display.service.MLButton;
	import com.googlecode.milib.display.service.MLMC;
	import com.googlecode.milib.vo.MLEventInfo;

	import flash.display.MovieClip;

	/**
	 * @author Marek Brun
	 */
	public class MLDBGGraphViewDot extends MLBaseClass implements IMLBroadcasterListener {

		private var mlmc:MLMC;
		private var btn:MLButton;
		private var data:MLDBGGraphLogData;

		public function MLDBGGraphViewDot(mc:MovieClip) {
			mlmc=MLMC.forInstance(mc);
			btn=MLButton.forInstance(mc);
			btn.addListener(this);
			mc.useHandCursor=false;
		}
		
		public function setData(data:MLDBGGraphLogData):void {
			this.data=data;
		}

		public function get mc():MovieClip { return mlmc.mc; };
		
//********************************************************************************************
//		events for MLDBGGraphViewDot
//********************************************************************************************
		public function onEvent(ev:MLEventInfo):void {
			switch(ev.hero){
				case btn:
					switch(ev.event) {
						case btn.event_Over:
							MLDBGTooltip.getInstance().setAlignByAngle(270);
							MLDBGTooltip.getInstance().setText(data.getLogs().join('\n'));
						break;
						case btn.event_Out:
							MLDBGTooltip.getInstance().setIsVisible(false);
						break;
					}
				break;
			}
		}
		
	}
}
